package model.gui;

import gui.StatusBar;
import gui.TabbedPane;
import java.awt.Component;
import model.DefaultModel;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Gebruiker
 */
public class MenuModel extends DefaultModel {

    private TabbedPane tabbedPane;
    private StatusBar status;

    public MenuModel(TabbedPane tabbedPane, StatusBar status) {
        this.tabbedPane = tabbedPane;
        this.status = status;
    }

    public void addTab(Component component, String title, boolean multipleTab) {
        if (multipleTab) {
            tabbedPane.addNewTab(component, title);
            tabbedPane.setSelectedComponent(component);
        } else {
            int index = tabbedPane.indexOfTab(title);
            if (index >= 0) {
                tabbedPane.setSelectedIndex(index);
            } else {
                tabbedPane.addNewTab(component, title);
                tabbedPane.setSelectedComponent(component);
            }
        }
    }
    
    public void setStatus(String s){
        status.setStatus(s);
    }
}
